#pragma once

#include "Render/VulkanDescriptor/VulkanDescriptorLayout.h"

//渲染像素对象全局数据
class CVulkanPixelObjectGlobal
{
private:
    CVulkanPixelObjectGlobal() = default;
    static CVulkanPixelObjectGlobal* Create();
public:    

    static CVulkanPixelObjectGlobal* Get();

    void Init();

    vk::RenderPass RenderPass;
    vk::PipelineLayout PipelineLayout;
    vk::Pipeline Pipeline;

    //逐模型的缓冲区
    struct alignas(16) SModelUniformBuffer
    {
        float ModelMatrix[16];

        //对象ID
        //uint16 就够了，但是为了和shader一致，使用uint32
        uint32_t ObjectID; 

        //填充，保证16字节对齐
        float Padding[3];
    };
    //描述符布局
    SVulkanDescriptorLayout DescriptorLayout;

    //视角描述符布局,包含一个缓冲区SPixelObjectViewUniformBuffer
    SVulkanDescriptorLayout ViewDescriptorLayout;
protected:
    void CreateRenderPass();
    void CreateDescriptorLayout();
    void CreatePipelineLayout();
    void CreatePipeline();
};
